package cn.felord.common.security.event;

import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;

/**
 * 刷新url 权限对照关系.
 *
 * @author Dax
 * @since 12 :26  2018/9/19
 */
public class UrlRolesRefreshEventPublisherAware implements ApplicationEventPublisherAware {
    private ApplicationEventPublisher applicationEventPublisher;
    private UrlRolesRefreshEvent urlRolesRefreshEvent;

    public UrlRolesRefreshEventPublisherAware(UrlRolesRefreshEvent urlRolesRefreshEvent) {
        this.urlRolesRefreshEvent = urlRolesRefreshEvent;
    }

    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
        this.applicationEventPublisher = applicationEventPublisher;
    }

    /**
     * Refresh.
     */
    public void refresh() {
        this.applicationEventPublisher.publishEvent(urlRolesRefreshEvent);
    }
}
